<script setup>
  const props = defineProps(['list'])

  const emit = defineEmits()

</script>

<template>
  <section class="main">
    <input id="toggle-all" class="toggle-all" type="checkbox" />
    <label for="toggle-all">Mark all as complete</label>
    <ul class="todo-list">
      <li v-for="item,index in props.list">
        <div class="view">
          <input class="toggle" type="checkbox" @keypress="emit('choose-todo', index)"/>
          <label>{{ item.name }}</label>
          <button class="destroy" @click="emit('del-todo', index)"></button>
        </div>
      </li>
    </ul>
  </section>
</template>